﻿using System.Collections.Generic;
using System.Threading.Tasks;

namespace CsvToSqlite
{
    /// <summary>
    /// CSV数据导入接口
    /// </summary>
    public interface ICsvDataImporter
    {
        /// <summary>
        /// 配置CSV文件格式
        /// </summary>
        /// <param name="delimiter">分隔符</param>
        /// <param name="hasHeader">是否包含表头</param>
        /// <param name="encoding">文件编码</param>
        void ConfigureCsvFormat(char delimiter = ',', bool hasHeader = true, string encoding = "utf-8");

        /// <summary>
        /// 设置需要导入的列映射
        /// </summary>
        /// <param name="columnMappings">列映射字典：键为CSV列名，值为数据库列名</param>
        void SetColumnMappings(Dictionary<string, string> columnMappings);

        /// <summary>
        /// 设置目标表信息
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="primaryKey">主键列名</param>
        void SetTargetTable(string tableName, string primaryKey);

        /// <summary>
        /// 从CSV文件导入数据到SQLite数据库
        /// </summary>
        /// <param name="csvFilePath">CSV文件路径</param>
        /// <param name="dbFilePath">SQLite数据库文件路径</param>
        /// <returns>导入的记录数</returns>
        Task<int> ImportAsync(string csvFilePath, string dbFilePath);
    }
}